<div id="page-label-wrapper">Add Category</div>
<br/>
<div id="validation-error-container" style="width: 100%;"></div>
<br/>
<form action="<?php echo site_url('admin/categories/create'); ?>" method="post">
	<label for="category_title"><?php echo lang('blog_category_title'); ?></label>
	<input name="cat_title" id="cat_title" type="text" size="50" value="" class="styled" />
	<fieldset id="action">
		<a href="#" class="btn btn-save"><span class="btn-icon disk-icon"></span><?php echo lang('blog_category_create'); ?></a>
	</fieldset>
</form>
<script type="text/javascript">
	$('.btn-save').click(function() {
		
		if (!$('#cat_title').val())
		{
			$('div#validation-error-container').html('<span class="error-box"><?php echo lang('blog_category_title'). ' is a required field'; ?></span>');
			return false;
		}
		
		var form_data = {
							title: $('#cat_title').val(),
							isAjax: '1'		
						};
		
		$.ajax({
			url: "<?php echo site_url('admin/categories/create'); ?>",
			type: 'POST',
			data: form_data,
			success: function(msg) {
				$('div#validation-error-container').html('<span class="success-box">Successfully created category</span>');
			}
		});	
		
		return false;
	});	
</script>